package lookas;

import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

import lookas.screen.MainScreen;
import lookas.screen.Screen;

public class GoogleGeoposMidlet extends MIDlet implements Screen {

	private Form form;
	private MainScreen screen;

	public GoogleGeoposMidlet() {
		form = new Form("Geopositioning");
	}

	protected void startApp() throws MIDletStateChangeException {
		Display.getDisplay(this).setCurrent(form);
		form.append("Loading...\n");
		screen = new MainScreen(this);
	}

	public GoogleGeoposMidlet getMidlet() {
		return this;
	}

	public Displayable getForm() {
		return screen.getForm();
	}

	public void close() {
		try {
			destroyApp(true);
		} catch (MIDletStateChangeException e) {
			Display.getDisplay(this).setCurrent(form);
			form.append(e.getMessage());
		}
		notifyDestroyed();
	}

	protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
	}

	protected void pauseApp() {
	}
}
